# encoding: utf-8
# 首先创建一个列表， 其中包含一些要打印的设计
unprinted_designs = ['iphone case', 'robot pendant', 'dodecahedron']
completed_models = []
# 模拟打印每个设计， 直到没有未打印的设计为止
# 打印每个设计后， 都将其移到列表completed_models中
while unprinted_designs:
    current_design = unprinted_designs.pop()
#模拟根据设计制作3D打印模型的过程
    print("Printing model: " + current_design)
    completed_models.append(current_design)

print(unprinted_designs)
# 显示打印好的所有模型
print("\nThe following models have been printed:")
for completed_model in completed_models:
    print(completed_model)

################
print("--------------NEXT------------")

def print_models(unprinted_designs, completed_models):
    """
    模拟打印每个设计， 直到没有未打印的设计为止
    打印每个设计后， 都将其移到列表completed_models中
    """
    while unprinted_designs:
        current_design = unprinted_designs.pop()
        # 模拟根据设计制作3D打印模型的过程
        print("Printing model: " + current_design)
        completed_models.append(current_design)

def show_completed_models(completed_models):
    """显示打印好的所有模型"""
    print("\nThe following models have been printed:")
    for completed_model in completed_models:
        print(completed_model)

unprinted_designs = ['iphone case', 'robot pendant', 'dodecahedron']
completed_models = []

print_models(unprinted_designs[0:], completed_models)
show_completed_models(unprinted_designs)
show_completed_models(completed_models)


print("--------------NEXT------------")
#*toppings将实参封装到一个元组中
def make_pizza(*toppings):
    """打印顾客点的所有配料"""
    print(toppings)

make_pizza('pepperoni')
make_pizza('mushrooms', 'green peppers', 'extra cheese')

print("--------------NEXT3------------")
#**user_info 两个星号让Python创建一个名为user_info 的空字典， 并将收到的所有名称—值对都封装到这个字典
def build_profile(first, last, **user_info):
    """创建一个字典， 其中包含我们知道的有关用户的一切"""
    profile = {}
    profile['first_name'] = first
    profile['last_name'] = last
    print(profile)
    for key, value in user_info.items():
        profile[key] = value
    return profile

user_profile = build_profile('albert', 'einstein',
                location='princeton',
                field='physics')
print(user_profile)